import { NextResponse } from "next/server";
import { prisma } from "@/db";

export const GET = async () => {
  const todos = await prisma.todo.findMany();

  return  NextResponse.json({
    success: true,
    data:todos,
    msg:''
  });

};

export const POST = async (req, res) => {
console.log('req222', req)
console.log('res', res)

  const { title, description } = req.body;
  console.log('title', title)
//   const todo = await prisma.todo.create({
//     data: {
//       title:'1111',
//  complete: false
//     },
//   });

  return  NextResponse.json({
    success: true,
    // data:todo,
    msg:''
  });
};